<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>轮播图</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/wlzz/css/font.css">
    <link rel="stylesheet" href="/wlzz/css/xadmin.css">
    <script type="text/javascript" src="/wlzz/js/jquery.min.js"></script>
    <script type="text/javascript" src="/wlzz/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/wlzz/js/xadmin.js"></script>
    <script>
        function  editBanner() {
            layer.msg('待开发', {icon: 7});
        }
        function deleteBanner(id){
            layer.confirm('您是否要删除该轮播图？', {
                btn: ['确定删除','不小心点错'] //按钮
            }, function(){
                $.post("/wlzz/backstage/deleteBanner",{id:id},function(data){
                       if(data.code==0){
                           layer.msg('删除成功', {icon: 1});
                           location.replace(location.href)
                       }else{
                           layer.msg(data.msg, {icon: 5});
                       }
                })

            }, function(){
                layer.msg('好，点错爸爸原谅你', {icon: 6});
            });
        }
        function addBanner_show(url){
            layer.open({
                type: 2,
                area: ['600px', '400px'],
                fix: false, //不固定
                maxmin: true,
                shadeClose: true,
                shade:0.4,
                title: "添加轮播图",
                content: url,
            });
        }

    </script>
    <style>

        td{
            width: 25%;
        }
    </style>
</head>

<body>
<button class="layui-btn" onclick="addBanner_show('/wlzz/backstage/banner_add')" style="margin: 10px 0px 0px 20px"><i class="layui-icon"></i>添加</button>
<table class="layui-table">
    <thead>
    <tr>
        <th>轮播图</th>
        <th>跳转链接</th>
        <th>创建时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
            <#list bannerList as banner>
            <tr>
                <td><img src="${banner.imgUrl}" ></td>
                <td><a href="${banner.url}" target="_blank">${banner.url}</a></td>
                <td>${banner.createTime}</td>
                <td><a style="cursor:pointer;" onclick="editBanner('${banner.id}')">修改</a>
                    <a style="cursor:pointer;" onclick="deleteBanner('${banner.id}')">删除</a></td>
            </tr>
            </#list>

    </tbody>
</table>
</body>

</html>